<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Grid 响应式</title>
    <style>
        .container {
            display: grid;
            grid-gap: 5px;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
            grid-template-rows: repeat(auto-fit, 50px);
        }
        .item1 {
            background-color: aquamarine;
            color:white;
            text-align: center;
            line-height: 50px;
        }
        .item2 {
            background-color: rgb(193, 255, 127);
            color:white;
            text-align: center;
            line-height: 50px;
        }
        .item3 {
            background-color: rgb(187, 127, 255);
            color:white;
            text-align: center;
            line-height: 50px;
        }
        .item4 {
            background-color: rgb(255, 127, 204);
            color:white;
            text-align: center;
            line-height: 50px;
        }
        .item5 {
            background-color: rgb(255, 127, 131);
            color:white;
            text-align: center;
            line-height: 50px;
        }
        .item6 {
            background-color: rgb(255, 172, 127);
            color:white;
            text-align: center;
            line-height: 50px;
        }
    </style>
</head>
<body>
    <div class="container">
            <div class="item1">1</div>
            <div class="item2">2</div>
            <div class="item3">3</div>
            <div class="item4">4</div>
            <div class="item5">5</div>
            <div class="item6">6</div>
    </div>
</body>
</html>